package org.springblade.modules.repair.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.repair.entity.MaintainPlanContentUser;
import org.springblade.modules.repair.enums.EmerProcTypeEnum;
import org.springblade.modules.repair.enums.MaintainPlanContentEnum;
import org.springblade.modules.repair.enums.WorkOrderTypeEnum;

import java.util.Date;
import java.util.List;

/**
 * @Date 9:36 2021/10/18
 * @Description {
 *    维修详情
 * }
 * @Author lsay
 **/
@Data
public class MalFunctionDetailVO {

	/**
	 * 任务 id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long planId;

	/**
	 * 任务状态
	 */
	private Integer status;

	/**
	 * 电梯id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long elevatorId;

	/**
	 * 计划开始时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date planDate;

	/**
	 * 预计完成时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
	private Date finishDate;

	/**
	 * 计划完成时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date planFinishDate;

	/**
	 * 源工单类型
	 */
	private Integer sourcePlanType;

	/**
	 * 源工单类型名称
	 */
	private String sourcePlanTypeName;

	/**
	 * 是否允许操作
	 */
	private Boolean updateStatus;

	/**
	 * 电梯状态： 1-正常,2-停梯
	 */
	private Integer elevatorStop;

	/**
	 * 故障信息
	 */
	private List<FaultMessageVO> faultMessageList;

	/**
	 * 报障信息
	 */
	private FaultReportVO faultReportVO;

	/**
	 * 故障原因
	 */
	private FaultReasonVO faultReasonVO;

	/**
	 * 维修详情最后一次任务
	 */
	private LastPlanVO lastPlan;

	/**
	 * 维修操作记录
	 */
	private List<MalFunctionHistoryVO> malFunctionHistories;

	/**
	 * 关联任务的用户
	 */
	private List<MaintainPlanContentUser> planContentUsers;

	/**
	 * 维修关联部件统计
	 */
	private Integer partsCount;

	/**
	 * 上一次工单签到
	 */
	private ElevatorLastPlanVO lastSignImg;

	/**
	 * 紧急程度
	 */
	private Integer emerProcType;

	/**
	 * 工单类型
	 */
	private Integer workOrderType;

	/**
	 * 紧急程度描述
	 */
	private String emerProcTypeName;

	/**
	 * 工单类型描述
	 */
	private String workOrderTypeName;

	/**
	 * 报告id
	 */
	private Long reportId;

	public void setEmerProcType(Integer emerProcType) {
		if(Func.isNotEmpty(emerProcType)){
			this.emerProcTypeName = EmerProcTypeEnum.getName(emerProcType);
		}
		this.emerProcType = emerProcType;
	}

	public void setWorkOrderType(Integer workOrderType) {
		if(Func.isNotEmpty(workOrderType)){
			this.workOrderTypeName = WorkOrderTypeEnum.getName(workOrderType);
		}
		this.workOrderType = workOrderType;
	}

	public void setSourcePlanType(Integer sourcePlanType) {
		if(Func.isNotEmpty(sourcePlanType)){
			this.sourcePlanTypeName = MaintainPlanContentEnum.getName(sourcePlanType);
		}
		this.sourcePlanType = sourcePlanType;
	}
}




























